package com.yjd.pub.mail.service;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.mail.model.MailModel;
import com.yjd.comm.mail.model.VerifyEmailModel;
import com.yjd.comm.mail.service.IVerifyEmailService;
import com.yjd.comm.util.StringUtil;
import com.yjd.pub.mail.dao.IVerifyEmailDao;

/**
 * <b>description</b>：邮箱验证业务实现<br>
 * <b>time</b>：2014-11-25 09:36:25 <br>
 * <b>author</b>：  percy-chen@hotmail.com
 */
@Service("verifyEmailService")
public class VerifyEmailServiceImpl extends BaseServiceImpl implements IVerifyEmailService {
	
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public VerifyEmailModel insert(VerifyEmailModel model) throws Exception {
		return this.verifyEmailDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(VerifyEmailModel model) throws Exception {
		return this.verifyEmailDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param user_id
	 * @return
	 * @throws Exception
	 */
	public int delete(Long user_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("user_id", user_id);
		return this.verifyEmailDao.deleteModel(paramMap, true);
	}

	@Resource
	private IVerifyEmailDao verifyEmailDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.verifyEmailDao;
	}

}
